<!--
 * @创建文件时间: 2021-11-19 22:29:21
 * @Auther: 猿小天
 * @最后修改人: 猿小天
 * @最后修改时间: 2021-11-20 09:36:45
 * 联系Qq:1638245306
 * @文件介绍: app版本管理
-->
<template>
  <d2-container :class="{'page-compact':crud.pageOptions.compact}">
    <d2-crud-x
        ref="d2Crud"
        v-bind="_crudProps"
        v-on="_crudListeners"
    >

      <div slot="header">

        <crud-search ref="search" :options="crud.searchOptions" @submit="handleSearch"  >
          <el-button slot="prefix" class="d2-mr-5" size="small" type="success" @click="addRow"><i class="el-icon-plus"/> 新增</el-button>
          <crud-toolbar :compact.sync="crud.pageOptions.compact"
                        :columns="crud.columns"
                        @refresh="doRefresh()"
                        @columns-filter-changed="handleColumnsFilterChanged"/>
        </crud-search>
        <el-button type="primary" size="small" icon="el-icon-download" @click="getDomain">拉取域名</el-button>
      </div>

      <template slot="FormHeaderSlot">
        <i class="el-icon-edit"/>
      </template>
    </d2-crud-x>

  </d2-container>
</template>

<script>
import * as api from './api'
import { crudOptions } from './crud'
import { d2CrudPlus } from 'd2-crud-plus'
export default {
  name: 'module_manage',
  mixins: [d2CrudPlus.crud],
  mounted () {
    // 一进页面就加载
  },
  data () {
    return {
      project: '',
      projects: [],
      show: false,
      formLabelWidth: '120px',
      form: { env: 'pre' }
    }
  },
  methods: {
    getCrudOptions () {
      return crudOptions(this)
    },
    pageRequest (query) {
      const forkeyId = this.$route.query.project
      return api.GetList({ ...query, project: this.project ? this.project : forkeyId })
    },
    addRequest (row) {
      const forkeyId = this.$route.params.project
      return api.createObj(row, forkeyId)
    },
    updateRequest (row) {
      return api.UpdateObj(row)
    },
    delRequest (row) {
      return api.DelObj(row.id)
    },
    // 跳转到添加按钮界面
    onLinkBtn () {
      this.$router.push({ path: '/button' })
    },
    // 拉取域名信息
    async getDomain () {
      await api.GetDomain(this.form)
      alert('拉取域名中，请稍后查看！')
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          this.show = false
          // done();
        })
        .catch(_ => {});
    }

  }
}
</script>

<style lang="scss">
.yxtInput {
  .el-form-item__label {
    color: #49a1ff;
  }
}
</style>
